from PIL import Image, ImageDraw, ImageFont

# 创建画布
img = Image.new('RGB', (600, 300), color='white')
draw = ImageDraw.Draw(img)
font = ImageFont.load_default()

# 绘制方程与解
draw.text((10, 10), "方程1: 2x + 3y = 5", fill="black", font=font)
draw.text((10, 40), "方程2: x - y = -1", fill="black", font=font)
draw.text((10, 70), "解: x = 0.40, y = 1.40", fill="blue", font=font)

# 保存图像
img_path = "system_equation_solution.png"
img.save(img_path)
print(f"图形已保存为 {img_path}")